package com.trkj.pojo;

import java.io.Serializable;
import javax.persistence.*;

import com.alibaba.fastjson.annotation.JSONField;

import java.sql.Timestamp;
import java.util.List;


/**
 * The persistent class for the DUTY database table.
 * 
 */
@Entity
@NamedQuery(name="Duty.findAll", query="SELECT d FROM Duty d")
public class Duty implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@SequenceGenerator(name="DUTY_DUTYID_GENERATOR", sequenceName="HR")
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="DUTY_DUTYID_GENERATOR")
	@Column(name="DUTY_ID")
	private long dutyId;

	@Column(name="DUTY_CREATORDATE")
	private Timestamp dutyCreatordate;

	@Column(name="DUTY_NAME")
	private String dutyName;

	@Column(name="DUTY_PERSON")
	private String dutyPerson;

	@Column(name="DUTY_UPDATEDATE")
	private Timestamp dutyUpdatedate;

	//bi-directional many-to-one association to PositionChange
	@OneToMany(mappedBy="duty")
	@JSONField(serialize=false)
	private List<PositionChange> positionChanges;

	//bi-directional many-to-one association to StaffInformation
	@OneToMany(mappedBy="duty")
	@JSONField(serialize=false)
	private List<StaffInformation> staffInformations;

	public Duty() {
	}

	public long getDutyId() {
		return this.dutyId;
	}

	public void setDutyId(long dutyId) {
		this.dutyId = dutyId;
	}

	public Timestamp getDutyCreatordate() {
		return this.dutyCreatordate;
	}

	public void setDutyCreatordate(Timestamp dutyCreatordate) {
		this.dutyCreatordate = dutyCreatordate;
	}

	public String getDutyName() {
		return this.dutyName;
	}

	public void setDutyName(String dutyName) {
		this.dutyName = dutyName;
	}

	public String getDutyPerson() {
		return this.dutyPerson;
	}

	public void setDutyPerson(String dutyPerson) {
		this.dutyPerson = dutyPerson;
	}

	public Timestamp getDutyUpdatedate() {
		return this.dutyUpdatedate;
	}

	public void setDutyUpdatedate(Timestamp dutyUpdatedate) {
		this.dutyUpdatedate = dutyUpdatedate;
	}

	public List<PositionChange> getPositionChanges() {
		return this.positionChanges;
	}

	public void setPositionChanges(List<PositionChange> positionChanges) {
		this.positionChanges = positionChanges;
	}

	public PositionChange addPositionChange(PositionChange positionChange) {
		getPositionChanges().add(positionChange);
		positionChange.setDuty(this);

		return positionChange;
	}

	public PositionChange removePositionChange(PositionChange positionChange) {
		getPositionChanges().remove(positionChange);
		positionChange.setDuty(null);

		return positionChange;
	}

	public List<StaffInformation> getStaffInformations() {
		return this.staffInformations;
	}

	public void setStaffInformations(List<StaffInformation> staffInformations) {
		this.staffInformations = staffInformations;
	}

	public StaffInformation addStaffInformation(StaffInformation staffInformation) {
		getStaffInformations().add(staffInformation);
		staffInformation.setDuty(this);

		return staffInformation;
	}

	public StaffInformation removeStaffInformation(StaffInformation staffInformation) {
		getStaffInformations().remove(staffInformation);
		staffInformation.setDuty(null);

		return staffInformation;
	}

}